package com.sylar.lelepub;

import android.app.Application;
import android.widget.Toast;

import com.baidu.mapapi.MKEvent;
import com.baidu.mapapi.MKGeneralListener;
import com.sylar.lelepub.tools.ImageCache;

public class LeLePubApplication extends Application{
	private ImageCache mImageCache;
	private static LeLePubApplication instance;
	private boolean m_bKeyRight = true;
	
	
	@Override
	public void onCreate() {
		super.onCreate();
		instance = this;
		mImageCache = new ImageCache();
	}
	
	public static LeLePubApplication getInstance() {
		return instance;
	}
	public ImageCache getImageCache(){
		return mImageCache;
	}
	
	public static class MyGeneralListener implements MKGeneralListener {
		@Override
		public void onGetNetworkState(int iError) {
			Toast.makeText(LeLePubApplication.instance.getApplicationContext(),
					"地图初始化错误。", Toast.LENGTH_LONG).show();
		}

		@Override
		public void onGetPermissionState(int iError) {
			if (iError == MKEvent.ERROR_PERMISSION_DENIED) {
				// 授权Key错误：
				Toast.makeText(
						LeLePubApplication.instance.getApplicationContext(),
						"授权Key错误", Toast.LENGTH_LONG)
						.show();
				LeLePubApplication.instance.m_bKeyRight = false;
			}
		}

	}
}
